<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>render_chart (FusionChartsHelper)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File lib/fusioncharts_helper.rb, line 57</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render_chart</span>(<span class="ruby-identifier">chart_swf</span>,<span class="ruby-identifier">str_url</span>,<span class="ruby-identifier">str_xml</span>,<span class="ruby-identifier">chart_id</span>,<span class="ruby-identifier">chart_width</span>,<span class="ruby-identifier">chart_height</span>,<span class="ruby-identifier">debug_mode</span>,<span class="ruby-identifier">register_with_js</span>,<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
    <span class="ruby-identifier">chart_width</span>=<span class="ruby-identifier">chart_width</span>.<span class="ruby-identifier">to_s</span>
    <span class="ruby-identifier">chart_height</span>=<span class="ruby-identifier">chart_height</span>.<span class="ruby-identifier">to_s</span>
    
    <span class="ruby-identifier">debug_mode_num</span>=<span class="ruby-value str">&quot;0&quot;</span>;
    <span class="ruby-identifier">register_with_js_num</span>=<span class="ruby-value str">&quot;0&quot;</span>;
    
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">debug_mode</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">true</span>
      <span class="ruby-identifier">debug_mode_num</span>=<span class="ruby-value str">&quot;1&quot;</span>
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">register_with_js</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">true</span>
      <span class="ruby-identifier">register_with_js_num</span>=<span class="ruby-value str">&quot;1&quot;</span>
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t&lt;!-- START Script Block for Chart &quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot; --&gt;\n\t\t&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>) 
    <span class="ruby-identifier">concat</span>(<span class="ruby-identifier">content_tag</span>(<span class="ruby-value str">&quot;div&quot;</span>,<span class="ruby-value str">&quot;\n\t\t\t\tChart.\n\t\t&quot;</span>,{<span class="ruby-identifier">:id=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;Div&quot;</span>,<span class="ruby-identifier">:align=</span><span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;center&quot;</span>}),<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\n\t\t&lt;script type='text/javascript'&gt;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\tvar chart_&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;=new FusionCharts('&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_swf</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;','&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;',&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_width</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;,&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_height</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;,&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">debug_mode_num</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;,&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">register_with_js_num</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;);\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    
    <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">str_xml</span><span class="ruby-operator">==</span><span class="ruby-value str">&quot;&quot;</span>
      <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\t&lt;!-- Set the dataURL of the chart --&gt;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
      <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\tchart_&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;.setDataURL(\&quot;&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">str_url</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;\&quot;);\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
      <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">&quot;The method used is setDataURL.The URL is &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">str_url</span>)
    <span class="ruby-keyword kw">else</span>
      <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\t&lt;!-- Provide entire XML data using DataXML method --&gt;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
      <span class="ruby-comment cmt">#concat(&quot;\t\t\t\tchart_&quot;+chart_id+&quot;.setDataXML(\&quot;&quot;+str_xml+&quot;\&quot;);\n&quot;,block.binding)</span>
      <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\t&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
      <span class="ruby-identifier">concat</span>(<span class="ruby-value str">'chart_'</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">'.setDataXML(\''</span><span class="ruby-operator">+</span><span class="ruby-identifier">str_xml</span><span class="ruby-operator">+</span><span class="ruby-value str">'\');'</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
      <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
      <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">&quot;The method used is setDataXML.The XML is &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">str_xml</span>)
    <span class="ruby-keyword kw">end</span>
    
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\t&lt;!-- Finally render the chart. --&gt;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t\t\tchart_&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;.render('&quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot;Div');\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t&lt;/script&gt;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    <span class="ruby-identifier">concat</span>(<span class="ruby-value str">&quot;\t\t&lt;!-- END Script Block for Chart &quot;</span><span class="ruby-operator">+</span><span class="ruby-identifier">chart_id</span><span class="ruby-operator">+</span><span class="ruby-value str">&quot; --&gt;\n&quot;</span>,<span class="ruby-identifier">block</span>.<span class="ruby-identifier">binding</span>)
    
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>